/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DatabaseExplorer.java
 *
 * Created on 9/10/2009, 01:54:35 PM
 */

package pradoeditor.databaseexplorer;

import com.vlsolutions.swing.docking.DockKey;
import com.vlsolutions.swing.docking.Dockable;
import java.awt.Component;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
import pradoeditor.comun.interfaces.Tree;

/**
 *
 * @author jaimeg
 */
public class DatabaseExplorer extends JPanel implements Dockable, Tree
{
    DockKey key = new DockKey("Explorador de Base de Datos");
    DefaultTreeModel modelo;
    DefaultMutableTreeNode nodeTop;

    /** Creates new form DatabaseExplorer */
    public DatabaseExplorer() {
        initComponents();
        initTree();

        key.setMaximizeEnabled(false);
    }

    public DockKey getDockKey(){
        return key;
    }

    public Component getComponent(){
        return this;
    }

     public void initTree()
     {
        nodeTop = new DefaultMutableTreeNode("DataBase");
        modelo = new DefaultTreeModel(nodeTop);
        treeDB.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        treeDB.setModel(modelo);
     }
     
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        treeDB = new javax.swing.JTree();

        jScrollPane1.setViewportView(treeDB);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTree treeDB;
    // End of variables declaration//GEN-END:variables

}
